RHCA436-基于CentOS8pacemaker+corosync 集群管理
1、启动集群
[root@nodea ~]# pcs cluster start --all
nodea.private.example.com: Starting Cluster...
nodec.private.example.com: Starting Cluster...
nodeb.private.example.com: Starting Cluster...
2、停止集群
[root@nodea ~]# pcs cluster stop --all
nodea.private.example.com: Stopping Cluster (pacemaker)...
nodec.private.example.com: Stopping Cluster (pacemaker)...
nodeb.private.example.com: Stopping Cluster (pacemaker)...
nodea.private.example.com: Stopping Cluster (corosync)...
nodeb.private.example.com: Stopping Cluster (corosync)...
nodec.private.example.com: Stopping Cluster (corosync)...
3、在集群中添加noded节点
yum -y install pcs fence-agents-ipmilan.noarch
firewall-cmd --permanent --add-service=high-availability
firewall-cmd --reload
systemctl enable --now pcsd
echo redhat | passwd --stdin hacluster
[root@nodea ~]# pcs host auth noded.private.example.com #对新加入的节点进行认证
[root@nodea ~]# pcs cluster node add noded.private.example.com #添加节点
[root@nodea ~]# pcs cluster enable noded.private.example.com #设置节点开机自启
[root@nodea ~]# pcs cluster start noded.private.example.com #启动节点
[root@nodea ~]# pcs cluster status
Cluster Status:
Cluster Summary:
* Stack: corosync
* Current DC: nodec.private.example.com (version 2.0.4-6.el8-2deceaa3ae) - partition with quorum
* Last updated: Thu Feb 10 15:43:48 2022
* Last change: Thu Feb 10 15:43:00 2022 by hacluster via crmd on noded.private.example.com
* 4 nodes configured
* 3 resource instances configured
Node List:
* Online: [ nodea.private.example.com nodeb.private.example.com nodec.private.example.com noded.private.example.com ]
PCSD Status:
noded.private.example.com: Online
nodea.private.example.com: Online
nodeb.private.example.com: Online
nodec.private.example.com: Online
[root@nodea ~]# pcs stonith create fence_noded fence_ipmilan pcmk_host_list=noded.private.example.com ip=192.168.0.104 username=admin password=password lanplus=1 power_timeout=180
[root@nodea ~]# pcs stonith status
* fence_nodea (stonith:fence_ipmilan): Started nodea.private.example.com
* fence_nodeb (stonith:fence_ipmilan): Started nodeb.private.example.com
* fence_nodec (stonith:fence_ipmilan): Started nodec.private.example.com
* fence_noded (stonith:fence_ipmilan): Started noded.private.example.com
4、移除节点
[root@nodea ~]# pcs cluster stop noded.private.example.com
[root@nodea ~]# pcs cluster node remove noded.private.example.com
[root@nodea ~]# pcs stonith delete fence_noded